package com.monicaca.service;

import com.monicaca.bean.WLK;
import com.monicaca.dao.WLKDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class WLKService {
	@Autowired
	private WLKDAO WLKDAO;
	
	public WLK findByRKDId(int WLKId) {  
        return WLKDAO.findById(WLK.class, WLKId);  
    }  
	/*public RKD findByRKDName(RKD RKD) {
        return RKDDAO.findByName(RKD);
    }*/


    public List<WLK> findAll() {  
        return WLKDAO.findAll(WLK.class);  
    }

    @Transactional  
    public void createWLK(WLK WLK) {  
    	WLKDAO.save(WLK);  
    }  
  
    @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW )

    public void updateWLK(WLK WLK) {  
    	WLKDAO.update(WLK);  
    }  
  
    @Transactional  
    public void deleteWLK(int WLKId) {  
    	WLKDAO.deleteById(WLK.class, WLKId);  
    }  
  
    @Transactional  
    public void deleteRKD(WLK WLK) {  
    	WLKDAO.delete(WLK);  
    }  
}
